package app.qrcode.browser.vacablarydemo.model.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import app.qrcode.browser.vacablarydemo.R
import app.qrcode.browser.vacablarydemo.model.bean.VocabularyBean
import kotlinx.android.synthetic.main.item_word.view.*
import java.lang.invoke.WrongMethodTypeException

/**
 * Created by YiGo on 2022/5/11.
 */
class WordAdapter : RecyclerView.Adapter<WordAdapter.ViewHolder>() {
    inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view)

    var wordList = mutableListOf<VocabularyBean>()

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.item_word, parent, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val word = wordList[position]
        holder.itemView.word_data_tv.text = word.word
    }

    override fun getItemCount(): Int = wordList.size


}